cmake_minimum_required(VERSION 3.20)

set(CMAKE_CXX_STANDARD 17)

project(
  DataStructure
  LANGUAGES CXX
  VERSION 0.1.0)

# 获取.cpp文件

file(
  GLOB_RECURSE
  _src
  CONFIGURE_DEPENDS
  "Common/*.cpp"
  "Input/*.cpp"
  "Result/*.cpp")

add_library(${PROJECT_NAME} SHARED ${_src})

# 项目宏定义
target_compile_definitions(${PROJECT_NAME} PRIVATE EXPORTING_DataStructure)

# 链接库
target_link_libraries(${PROJECT_NAME} PRIVATE Algebra Configuration Logging)

# Header files install
install(
  DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  DESTINATION include
  FILES_MATCHING
  PATTERN "*.h"
  PATTERN "UnitTest" EXCLUDE)

install(
  TARGETS ${PROJECT_NAME}
  ARCHIVE DESTINATION lib
  RUNTIME DESTINATION bin)

# 单元测试
if(SG_BUILD_UNIT_TEST)
  add_subdirectory(UnitTest)
endif()
